﻿using System;
using System.ComponentModel;
using System.Windows;
using Brjnk.Common;

namespace Brjnk.GpxExplorer.UI
{
    /// <summary>
    /// Interaction logic for SimplifyTrackWindow.xaml
    /// </summary>
    public partial class SimplifyTrackWindow : Window, INotifyPropertyChanged
    {
        public SimplifyTrackWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }

        private Distance maxDistance = 30;

        public Distance MaxDistance
        {
            get { return maxDistance; }
            set
            {
                if (maxDistance < 0) throw new ArgumentException("Negative value");
                maxDistance = value; OnPropertyChanged("MaxDistance");
            }
        }

        private bool keepElevationLocalExtremes = true;

        public bool KeepElevationLocalExtremes
        {
            get { return keepElevationLocalExtremes; }
            set { keepElevationLocalExtremes = value; OnPropertyChanged("KeepElevationLocalExtremes"); }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}